import Vue from 'vue'
import App from './App.vue'
import router from './router'
import 'default-passive-events'
import './plugins/element.js'
import FileSaver from 'file-saver'
import XLSX from 'xlsx'
import Base from './assets/js/base.js'
import Config from './assets/js/config.js'
import Function from './assets/js/function.js'
import sBreadcrumb from './components/s-breadcrumb/s-breadcrumb.vue'
// 导入全局样式
import './assets/css/base.css'
// 导入图标库
import './assets/fonts/iconfont.css'
// 导入ajax请求
import axios from 'axios'
import VueQuillEditor from 'vue-quill-editor'

// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)

// 引入全局方法
Vue.use(Function)
// 配置请求的根路径
axios.defaults.baseURL = Config.baseURL
// 添加请求头信息
axios.interceptors.request.use(config => {
  const tokenType = window.sessionStorage.getItem('token_type') || ''
  const token = window.sessionStorage.getItem('token') || ''
  config.headers.Authorization = tokenType + ' ' + token
  config.headers.apikey = Config.apikey
  return config
})
Vue.prototype.$http = axios
Vue.prototype.$base = Base
Vue.prototype.$config = Config
Vue.prototype.$FileSaver = FileSaver
Vue.prototype.$XLSX = XLSX
Vue.component('s-breadcrumb', sBreadcrumb)
Vue.config.productionTip = false
// Vue.filter('is_auth', function (href) {
//   var childrenHref = window.sessionStorage.getItem('childrenHref')
//   if (childrenHref) {
//     childrenHref = JSON.parse(childrenHref)
//     for (var i = 0; i < childrenHref.length; i++) {
//       if (href === childrenHref[i].href) {
//         return false
//       }
//     }
//   }
//   return true
// })
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
